<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <script type="text/javascript" src="../../inc/ctx.jsp"></script>
        <script type="text/javascript" src="../js/g.js"></script>
        <script type="text/javascript" src="../js/channeltype.js"></script>
        <link href="../css/com.css" type="text/css" rel="stylesheet"/>
<script type="text/javascript" src="http://cdn.uuola.cn/js/formvalid.js" charset="utf-8"></script>
    </head><body>
<div id="panel">
    <form id="frm" name="frm">
        <input type="hidden" name="cid" id="cid" value="" />
    <input type="hidden" name="ctp" id="ctp" value="" />
    <input type="hidden" name="channeltype" id="channeltype" value="" />
        <table>
            <tr>
                <td width="10%" class="r">tag名称</td>
                <td width="26%">
                    <input name="tagname" type="text" id="tagname" tabindex="1" maxlength="32" valid="required" errmsg="tag名称不能为空!" />* </td>
                <td width="13%">&nbsp;</td>
            </tr>
            <tr>
                <td class="r">发布状态</td>
                <td><select name="pubstate" id="pubstate" tabindex="2">
                        <option value="0">否</option>
                        <option value="1">是</option>
                    </select></td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td><input name="submitBtn" type="button" class="button medium orange" id="submitBtn" tabindex="7" value="添加" onClick="TagFrm.submit();" /></td>
                <td>&nbsp;</td>
            </tr>
        </table>
    </form>
</div>



<script type="text/javascript">
    var page = ut.get('page') || 1;
    var TagFrm={
        init:function(){
           $('#cid').val(ut.get('cid'));
           $('#ctp').val(ut.get('ctp'));
           $('#channeltype').val(ut.get('channeltype')); 
       },
        submit:function(){
            var $rb=$('#submitBtn');
            if(!va.title($('#tagname').val())){
                ut.m('tag名称不符合要求,请不要使用特殊字符.');
                return; 
            }
            if(validator(ut.e('frm'))){
                $rb.attr('disabled','disabled');
                $.post('../app/tags/make.shtm',ut.getFormData('#frm'),function(x){
                    var r = $.trim(x);
                    if(r=='ok'){
                        ut.m('添加TAG成功!');
                        window.parent.window.TAG.list(page,0);
                        window.parent.window.TxBox.closeWinpop();
                    }else{
                        ut.m('添加失败!'+r);
                        $rb.removeAttr('disabled');
                    }
                });
            }   
        }
    };  
   
    TagFrm.init();
</script>
</body></html>